<?php

namespace Xrfg\Wallet\TRX\Providers;

use Illuminate\Support\ServiceProvider as IlluminateServiceProvider;
use Xrfg\Wallet\TRX\Console\CollectTRC20;
use Xrfg\Wallet\TRX\Console\RechargeTRC20;
use Xrfg\Wallet\TRX\Console\RechargeTRX;

class ServiceProvider extends IlluminateServiceProvider
{
    public function boot()
    {
        $this->registerPublishing();
        $this->registerCommands();
    }

    public function register()
    {
        $this->mergeConfigFrom(
            __DIR__.'/../../config/trx.php', 'wallet.trx'
        );
    }

    private function registerPublishing()
    {
        if ($this->app->runningInConsole()) {
            $this->publishes([
                __DIR__.'/../../config/trx.php' => config_path('wallet/trx.php'),
            ]);
        }
    }

    private function registerCommands()
    {
        if ($this->app->runningInConsole()) {
            $this->commands([
                RechargeTRX::class,
                RechargeTRC20::class,
                CollectTRC20::class
            ]);
        }
    }
}
